<template>
    <div class="generalParameter"></div>
</template>

<style lang="less" scoped>
.generalParameter {
    height: 100%;
    width: 100%;
    text-align: center;
}
</style>
<script>
export default {
    name: 'generalParameterChart',
    data() {
        return {
            generalParameterChart: null
        }
    },
    methods: {
        setChart() {
            let option = {
                title: {
                    // text: 'Step Line'
                },
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data: ['传感器1', '传感器2', '传感器3']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '25%',
                    containLabel: true
                },
                xAxis: {
                    type: 'category',
                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name: '传感器1',
                        type: 'line',
                        step: 'start',
                        data: [120, 132, 101, 134, 90, 230, 600]
                    },
                    {
                        name: '传感器2',
                        type: 'line',
                        step: 'middle',
                        data: [220, 282, 201, 234, 290, 430, 410]
                    },
                    {
                        name: '传感器3',
                        type: 'line',
                        step: 'end',
                        data: [450, 432, 401, 454, 590, 530, 510]
                    }
                ]
            };
            if (!this.generalParameterChart) this.generalParameterChart = this.$echarts(this.$el);
            this.generalParameterChart.clear();
            this.generalParameterChart.resize()
            this.generalParameterChart.setOption(option);
        },
    },
    mounted() {
        this.setChart();
    },
}
</script>
